#include "UUIDGenerator.h"

#include <windows.h>

#if (defined UNICODE || defined _UNICODE)
#	define	RPC_TSTR RPC_WSTR
#else
#	define	RPC_TSTR RPC_CSTR
#endif


namespace platform {

void UUIDGenerator::Create(XString &res) {
	UUID id;
	RPC_STATUS st = ::UuidCreateSequential(&id);
	RPC_TSTR asString;
	st = ::UuidToString(&id, &asString);
	if (st == RPC_S_OK) {
		res = (TCHAR*) asString;
		res.toUpper();
		::RpcStringFree(&asString);
	}
}


}  // end namespace
